package ciyuan.Block.Machine.fsj;

import ciyuan.MainClass;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.gui.screen.inventory.ContainerScreen;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.ITextComponent;

public class FsjScreen extends ContainerScreen<FsjContainer> {

    private final ResourceLocation location1 = new ResourceLocation(MainClass.MODID, "textures/gui/container/fsj.png");
    private final ResourceLocation location2 = new ResourceLocation(MainClass.MODID, "textures/gui/container/progress.png");
    private final int textureWidth = 176;
    private final int textureHeight = 166;

    public FsjScreen(FsjContainer p_i51105_1_, PlayerInventory p_i51105_2_, ITextComponent p_i51105_3_) {
        super(p_i51105_1_, p_i51105_2_, p_i51105_3_);
    }

    @Override
    protected void renderBg(MatrixStack matrixStack, float p_230450_2_, int p_230450_3_, int p_230450_4_) {
        renderBackground(matrixStack);
        RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.minecraft.getTextureManager().bind(location1);
        int i = this.leftPos;
        int j = this.topPos;
        this.blit(matrixStack, i, j, 0, 0, this.imageWidth, this.imageHeight,this.imageWidth,this.imageHeight);
        drawProcess(matrixStack);
    }

    @Override
    public void render(MatrixStack p_230430_1_, int p_230430_2_, int p_230430_3_, float p_230430_4_) {
        super.render(p_230430_1_, p_230430_2_, p_230430_3_, p_230430_4_);
        this.renderTooltip(p_230430_1_, p_230430_2_, p_230430_3_);
    }

    private void drawProcess(MatrixStack matrixStack) {
        RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
        this.minecraft.getTextureManager().bind(location2);
        int pro = this.getMenu().FsjTileEntity.containerProgress.get(0);
        double dou = pro/600.0;
        int i = this.leftPos+60;
        int j = this.topPos+32;
        this.blit(matrixStack, i, j, 0, 0, (int)(55*dou), 15,(int)(55*dou),15);
    }



}
